# coding=utf-8
import time
import traceback

import requests
#from BeautifulSoup import BeautifulSoup version 3.0.0
from bs4 import BeautifulSoup
from pymongo import MongoClient
import json

import uuid


import Utils



def get_stock_info():

    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/60.0.3100.0'};

    get_captcha_url = 'https://accounts.binancezh.pro/gateway-api/v1/public/antibot/getCaptcha';
    args = {'bizId': 'login'}
    response = requests.request("get", get_captcha_url, params=args, headers=headers);
    js = json.loads(response.content)
    url = 'https://accounts.binancezh.pro/gateway-api/v1/public/antibot/validateCaptcha'
    args = {};
    args['bizId'] = 'login'
    #uid = str(uuid.uuid4())
    args['sig'] = js['data']['sig'];
    args['data'] = 'SRNXTkNDGkhFVRACUkpNSFtcEAJVSE1IVlQQAkNbTUhQQ15ZQ0NZXx4TQkoFHENQEAULFFRMTVsHHQcJQ1VDGl4TCBosGAIjXEVXVENVQx1bWFxQBFtbXgEGHhoWEA4fWlQQAllOVhceE1BdQ0MaSFdSEAIaWwwHEAsDClBVQwdWEwgJTVsMHxALA0VNWwQGEAtpGhIVHQdfTQUIVFVSWQRNAw5RTVlSBgcKAFhOUBYDEx4aEhUdB19NBQhUVVJZCk0DRFBbTUhBXU5VDAVWWgcdAQxQBVQWAxMeGhIVHQdfTQUIVVVSXgRNCkRQW01IRVhOVQwFVloGHQENVQVYFgMTHhoWEB0HX00FCFJVUlwATQVEUFtNSEVYTlUMBVZaAR0BD1EFWRYDEx4aFhAdB19NBQhSVVJdB00KRFBbTUhFWE5VDAVWWgMdAQBVBVBYTgAQFEMOCBZfXE4PUUhNWQsDTgwdSENGEEZbRAwUHVwHAh4LWEsdWwYGAERQW01IRVhOVQwFV14CHQEAUwVZFgMTHhoWEB0HX00EClhVUl0HTQtEUFtNSEVYTlUMBVdYBh0BD1MFVhYDEx4aFhAdB19NBAlXVVJcBE0KRFBbTUhFWE5VDAVXWgsdAQ5TBVkWAxMeGhYQHQdf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HQEAQ1VDB19NAQlNSllIHhNfVR1KUUYBBhAUQxQMFgEBHgtWW01IX1xOC1FVUl0QHRBVDAVSWh4CBRpNWwwHTgICFFJPQ0YQXF9EUklNWQQTHhoMFB1ZAh0BDkNVQwdfTQEITUpUSB4TX1UdSlFGAQQQFEMUDBYBAR4LVFtNSF9cTgtRVVJeEB0QVQwFUloeAgYaTVsMB04CAhRSTUNGEFxfRFNATVkBEx4aDBQdWAsdAQtDVUMHVk0AAU1KUkgeE19VHUpRRgECEBRDFAwWAQEeC1JbTUhfXE4LUFVSWRAdEFUMBVJTHgIBGk1bDAdOAgQUUkpDRhBcV0RTQE1ZAxNvFEMKCEgIShBPQ0NVXh4TWhpbTVUXT0weGgUQEh4QCwAMVQQ%3D'
    headers = {'Content-Type': 'text/plain', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/60.0.3100.0'}
    response = requests.request("post", url, params=args, headers=headers);
    response_content = response.content;
    response_content = response_content.decode("GBK").encode("UTF-8")
    Utils.logger.info(response_content);

get_stock_info()